<template>
	<div>
		<homeheader :city="city"></homeheader>
		<homeswiper :list="swiperList"></homeswiper>
		<homeicons :list="iconList"></homeicons>
		<homerecommend :list="recommendList"></homerecommend>
		<homeWeek :list="weekendList"></homeWeek>
	</div>
</template>

<script>
import homeheader from './components/header'
import homeswiper from './components/swiper'
import homeicons from './components/icons'
import homerecommend from './components/recommend.vue'
import homeWeek from './components/weekend.vue'	
import axios from 'axios'
export default {
	name: 'Home',
	components: {
		homeheader,
		homeswiper,
		homeicons,
		homerecommend,
		homeWeek
		},
		data () {
			return {
				city: '',
				swiperList: [],
				iconList: [],
				recommendList: [],
				weekendList: []
			}
		},
		methods: {
			getHomeInfo () {
				axios.get('/api/index.json')
				 .then(this.getHomeInfoSucc)
			},
			getHomeInfoSucc (res) {
				res = res.data
				if (res.ret && res.data) {
					const data = res.data
					this.city = data.city
					this.swiperList = data.swiperList
					this.iconList = data.iconList
					this.recommendList = data.recommendList
					this.weekendList = data.weekendList
				}
			}
		},
		mounted () {
			this.getHomeInfo()
		}
	}
</script>

<style>
	
</style>